package ThreadPool;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

public class DemoExecutor {

	private static Runnable task = new Runnable() {

		@Override
		public void run() {
			System.out.println(Thread.currentThread().getName());
		}
	};

	public static void main(String[] args) {
		Executor exec = Executors.newCachedThreadPool(); // 超过了处理需求时回收空闲的线程，需求增加是添加新的线程，线程池的规模不存在限制
		exec.execute(task); // 返回void；同时缺少对线程池的控制，如返回future，关闭pool，中断等等
		// 线程一直不退出
	}
}
